package com.example.druid.demo_druid.service;

import com.example.druid.demo_druid.enums.DatabaseType;
import com.example.druid.demo_druid.interceptor.DataSource;
import com.example.druid.demo_druid.mapper.ClassMapper;
import com.example.druid.demo_druid.model.Classes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author devsun
 *         Created by on 2017/12/10.
 */
@Service
public class ClassService {

    @Autowired
    private ClassMapper classDao;

    @DataSource(databaseType = DatabaseType.springbootcluster)
    public List<Map<String,Object>> getList(){
        List<Classes> classes = classDao.selectAll();
        classDao.insertClass();
        return classDao.findClassList();
    }
}
